//
// Created by hsj on 2022/1/18.
//
#include <iostream>
#include "t_class_extend.h"

namespace hsj_class_extend{

    TableTennisPlayer::TableTennisPlayer(const string &fn,const string &ln,bool ht)
    :firstName(fn),lastName(ln),hasTable(ht){
      //使用成员列表初始化构造函数
      cout<<"TableTennisPlayer init..."<<endl;
    }

    void TableTennisPlayer::Name() const{
        cout<<" firstName:"<<firstName<<"  lastName:"<<lastName<<endl;
    }

    RatedPlayer::RatedPlayer(unsigned int r,const string &fn,const string &ln,bool ht)
    :TableTennisPlayer(fn,ln,ht){
         rating = r;
         cout<<"RatedPlayer init..."<<endl;
    }

    RatedPlayer::RatedPlayer(unsigned int r,const TableTennisPlayer &ttp)
    :TableTennisPlayer(ttp){//调用基类的复制构造函数【理论上是浅复制，但是string类重写了复制构造函数，string类型的fn/ln已经深复制了】
        rating = r;
        cout<<"RatedPlayer init..."<<endl;
    }
}